<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path = request.getContextPath();%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>登录</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="stylesheet" href="<%=path%>/AmazeUI-2.4.2/assets/css/amazeui.css"/>
    <link href="<%=path%>/css/dlstyle.css" rel="stylesheet" type="text/css">
</head>

<body>

<div class="login-boxtitle">
    <a href="home2.jsp"><img alt="logo" src="<%=path%>/images/logobig.png"/></a>
</div>

<div class="login-banner">
    <div class="login-main">
        <div class="login-banner-bg"><span></span><img src="<%=path%>/images/big.jpg"/></div>
        <div class="login-box">
            <h3 class="title">登录商城</h3>
            <div class="clear"></div>
            <!--登录错误提示-->
            <c:if test="${msg != null}">
                <span style="color: red;font-size: 14px" id="loginMsg">${msg}</span>
            </c:if>
            <span style="color: red;font-size: 14px;display: none" id="fk"></span>
            <div class="login-form">
                <form action="<%=path%>/usersLogin" method="post">
                    <div class="user-name">
                        <label for="user"><i class="am-icon-user"></i></label>
                        <c:if test="${name==null}">
                            <input type="text" name="username" id="user" placeholder="邮箱/手机/用户名">
                        </c:if>
                        <c:if test="${name!=null}">
                            <input type="text" name="username" value="${name}" id="user" placeholder="邮箱/手机/用户名">
                        </c:if>
                    </div>

                    <div class="user-pass">
                        <label for="password"><i class="am-icon-lock"></i></label>
                        <input type="password" name="password" id="password" placeholder="请输入密码">
                    </div>
                </form>
                <div></div>
            </div>

            <div class="login-links">
                <label for="remember-me"><input id="remember-me" type="checkbox">记住密码</label>
                <a href="#" class="am-fr">忘记密码</a>
                <a href="register.jsp" class="zcnext am-fr am-btn-default">注册</a>
                <br/>
            </div>
            <div class="am-cf">
                <input type="submit" name="login" id="login" value="登 录" class="am-btn am-btn-primary am-btn-sm">
            </div>
            <div class="partner">
                <h3>合作账号</h3>
                <div class="am-btn-group">
                    <li><a href="#"><i class="am-icon-qq am-icon-sm"></i><span>QQ登录</span></a></li>
                    <li><a href="#"><i class="am-icon-weibo am-icon-sm"></i><span>微博登录</span> </a></li>
                    <li><a href="#"><i class="am-icon-weixin am-icon-sm"></i><span>微信登录</span> </a></li>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="foot.jsp"></jsp:include>

<script src="js/jquery.js"></script>
<script>
    function ycMsg(){
         $("#loginMsg").hide();
    }
    $(function () {
        var msg = $("#loginMsg");
        if(msg.text() != ""){
             //2s后隐藏
            setTimeout("ycMsg()",1500);
         }
     });
    function gbMsg() {
        $("#fk").hide();
    }
    function dkMsg(msg){
        $("#fk").show();
        $("#fk").text(msg);
    }
    function pdName(){
        var name = $("#user").val();
        if (name==""){
            dkMsg("请输入用户名!");
            setTimeout("gbMsg()",1500);
            $("#user").focus();
            return false;
        }
        return true;
    }
    function pdPwd(){
        var pwd = $("#password").val();
        if (pwd==""){
            dkMsg("请输入密码!");
            setTimeout("gbMsg()",1500);
            $("#password").focus();
            return false;
        }
        return true;
    }
    $("input[name='login']").click(function(){
        if (pdName()&&pdPwd()){
            $("form").submit();
        }
    })
</script>
</body>

</html>